<div class="container-fluid">
    <div class="row">
        <div class="col-md-12">
            <small class="text-muted">网址：需包含 http 或 https 前缀 &nbsp; &nbsp; &nbsp; 电话：tel:电话号码 &nbsp; &nbsp; &nbsp; 邮箱：mailto:邮箱地址</small>
            <input id="txt" type="text" class="form-control" placeholder="内容：网址、电话、邮箱" autofocus />
            <div id="divCodeResult" class="mt-3 w-auto" style="height:300px;"></div>
        </div>
    </div>
</div>

@Html.Raw(Netnr.SharedApp.QuoteTo.Html("qrcode.js"))

<script>
    $('#txt').on('input', function () {
        if ($.trim($("#txt").val()) != "") {
            $("#divCodeResult").empty();

            new QRCode(document.getElementById("divCodeResult"), {
                text: $("#txt").val(),
                width: 300,
                height: 300,
                colorDark: "#000000",
                colorLight: "#ffffff",
                correctLevel: QRCode.CorrectLevel.H
            });
        } else { $("#divCodeResult").html(''); }
    });
</script>
